import { User as UserEntity } from '@/entity/User';
import { PaginationConfig } from '@/types';

export type UserLoginRequest = Pick<UserEntity, 'username' | 'password'>;

export type UserRegisterRequest = Pick<
  UserEntity,
  'username' | 'password' | 'email'
> & {
  roleId: number;
  code: string;
};

export type UserModifyRequest = Pick<
  UserEntity,
  'email' | 'avatarImage' | 'nickname'
> & {
  roleIds: number[];
};

export type UserBaseInfoRequest = Pick<
  UserEntity,
  'email' | 'avatarImage' | 'nickname'
>;

export interface UserModifyPasswordRequest {
  // 用于找到用户
  email: string;
  code?: string;
  password: string;
  oldPassword?: string;
}

export interface CreateUserRequest {
  username: string;
  email: string;
  nickname: string;
  roleIds: number[];
}

export type GetUsersRequest = PaginationConfig &
  Partial<Pick<UserEntity, 'username' | 'nickname' | 'id' | 'email'>>;
